import { createRequest } from '/@/api/service';
const module = 'ib/base/v1/sysuser/SysRegionApi/';

/**
 * @function 查询（区域表）
 * @param data
 * @param header
 * @returns {Promise}
 */
function SYS_REGION_QUERY(
  data: SysRegionApi.SysRegionQueryReq,
  header: object = {},
): Promise<SysRegionApi.SysRegionQueryResp> {
  return createRequest(`${process.env.APP_API_URL}${module}sysRegionQuery`, data, header, 'POST');
}

/**
 * @function 列表查询
 * @param data
 * @param header
 * @returns {Promise}
 */
function SYS_REGION_LIST(
  data: SysRegionApi.SysRegionListReq,
  header: object = {},
): Promise<SysRegionApi.SysRegionListResp> {
  return createRequest(`${process.env.APP_API_URL}${module}sysRegionList`, data, header, 'POST');
}

/**
 * @function 查询楼号及楼层
 * @param data
 * @param header
 * @returns {Promise}
 */
function SYS_REGION_BY_AREA_UNIT_AND_AREA_FLOOR(
  data: SysRegionApi.SysRegionListReq,
  header: object = {},
): Promise<SysRegionApi.SysRegionListResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}sysRegionByAreaUnitAndAreaFloor`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 根据楼层查询房间
 * @param data
 * @param header
 * @returns {Promise}
 */
function GET_AREA_ROOM_BY_FLOOR(
  data: SysRegionApi.GetAreaRoomByFloorReq,
  header: object = {},
): Promise<SysRegionApi.GetAreaRoomByFloorResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}getAreaRoomByFloor`,
    data,
    header,
    'POST',
  );
}

export {
  SYS_REGION_QUERY,
  SYS_REGION_LIST,
  SYS_REGION_BY_AREA_UNIT_AND_AREA_FLOOR,
  GET_AREA_ROOM_BY_FLOOR,
};
